﻿@model SpyApp.Models.AccountModel.AdminEdit
@using SpyApp.Helpers;
@{
    ViewBag.Title = "Edit Account: " + Model.UserName;
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<div class="page-header">
    <h3>@ViewBag.Title</h3>
</div>

@using (Html.BeginForm("EditAccount", "Admin"))
{
    @Html.AntiForgeryToken() // chặn sử dụng web khác
    @Html.ValidationSummary(true)
    
    <div class="form-post">
        <ul>
            <li class="form-row">
                @Html.LabelFor(m => m.Id, new { @class = "form-column form-label medium-2 xsmall-12" })
                @Html.Label(Model.Id, new { @class = "form-column form-text medium-10 xsmall-12" })
            </li>
            <li class="form-row">
                @Html.LabelFor(m => m.UserName, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html._TextBoxPlaceHolderFor(m => m.UserName, null)
                    @Html.ValidationMessageFor(m => m.UserName)
                </div>
            </li>
            <li class="form-row">
                @Html.LabelFor(m => m.PassWord, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html._TextBoxPlaceHolderFor(m => m.PassWord, null)
                    @Html.ValidationMessageFor(m => m.PassWord)
                </div>
            </li>
            <li class="form-row">
                @Html.LabelFor(m => m.ActiveInvationCode, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html._TextBoxPlaceHolderFor(m => m.ActiveInvationCode, null)
                    @Html.ValidationMessageFor(m => m.ActiveInvationCode)
                </div>
            </li>
            <li class="form-row">
                @Html.LabelFor(m => m.Age, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html.TextBoxFor(m => m.Age)
                    @Html.ValidationMessageFor(m => m.Age)
                </div>
            </li>
            <li class="form-row">
                @Html.LabelFor(m => m.TotalLogin, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html.TextBoxFor(m => m.TotalLogin)
                    @Html.ValidationMessageFor(m => m.TotalLogin)
                </div>
            </li>

            <li class="form-row">
                @Html.LabelFor(m => m.UserStatus, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html.DropDownListFor(m => m.UserStatus, Model.AllUserStatus)
                    @Html.ValidationMessageFor(m => m.UserStatus)
                </div>
            </li>

            <li class="form-row">
                @Html.LabelFor(m => m.Status, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html.DropDownListFor(m => m.Status, Model.AllObjectStatus)
                    @Html.ValidationMessageFor(m => m.Status)
                </div>
            </li>

            <li class="form-row">
                @Html.LabelFor(m => m.UserType, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    @Html.DropDownListFor(m => m.UserType, Model.AllUserType)
                    @Html.ValidationMessageFor(m => m.UserType)
                </div>
            </li>

            <li class="form-row">
                @Html.LabelFor(m => m.UserInRoles, new { @class = "form-column form-label medium-2 xsmall-12" })
                <div class="form-column medium-10 xsmall-12">
                    <div class="list-vertical">
                    @for (int i = 0; i < Model.UserInRoles.Count(); i++)
                    {
                        <div>
                            @Html.CheckBoxFor(m => m.UserInRoles[i].Selected)
                            @Html.LabelFor(m => m.UserInRoles[i].Selected, Model.UserInRoles[i].Text)
                            @Html.HiddenFor(m => m.UserInRoles[i].Value)
                            @Html.HiddenFor(m => m.UserInRoles[i].Text)
                        </div>
                    }
                    </div>
                    @Html.ValidationMessageFor(m => m.UserType)
                </div>
            </li>

            <li class="form-row">
                <div class="form-column medium-12 page-footer">
                    @Html._SubmitButton("Save")
                    @Html.ActionLink("Cancel", "Account")
                </div>
            </li>
        </ul>
    </div>
}

@section Script {
    @Scripts.Render("~/bundles/jqueryval")
}